fix bug when use proxy-express as a reverse proxy server#34
Open
sysuzhang wants to merge 2 commits intojohnhof:masterfrom
Open
fix bug when use proxy-express as a reverse proxy server#34sysuzhang wants to merge 2 commits intojohnhof:masterfrom
sysuzhang wants to merge 2 commits intojohnhof:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When I use proxy-express as a reverse proxy server, if the target server will need to use the 'host' value in HTTP header. It usually refers to the request host, not the target server host. for example:
If I want to use www.b.com proxy pass to www.a.com server, then actually my server host name is www.b.com, but not www.a.com. If not, one problem is that:
when user visit to www.b.com, and the server www.a.com produces a 302 redirect, the redirect location value in HTTP header is www.a.com/path. The value comes from the host value setting in HTTP header. But the browser can't not redirect to www.a.com/path.
In other proxy server case, like nginx, when we use nginx as a reverse server , we usually config like this:
location ^~ /
{
proxy_pass http://192.168.1.112:8680/;
proxy_set_header Host $host;
proxy_set_header Port $server_port;
}
It means that I can pass the font host value to the target server.
But I found that, proxy.js set the host value directly use that target server host around line 155, just like:
I thought a lot why you set this value, I just find one situation that your target server is a virtual host website, We need to set the host as the target server host, then we can use another domain to visit. In other case I thought it is better not to change the host value.
Pls let me know more reasons about setting the host value, or maybe we can add an usege example to indicate the web-hosting's case.